import {
	instance
} from "@/utils";

/**
 * 用户登录
 * @param {*} data
 * @returns
 */
export async function userLoginApi(data) {
	return instance.request({
		url: "/userAccount/appletLogin",
		method: "post",
		data,
	});
}


/**
 * 用户信息
 * @param {*} data
 * @returns
 */
export async function userInfoApi(data) {
	return instance.request({
		url: "/userAccount/getUserInfo",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 解析用户openId
 * @param {*} data
 * @returns
 */
export async function appletDecodeOpenIdApi(data) {
	return instance.request({
		url: "/userAccount/appletDecodeOpenId",
		method: "post",
		data,
	});
}



/**
 * 获取用户邀请类型
 * @param {*} data
 * @returns
 */
export async function getInviteInfoApi(data) {
	return instance.request({
		url: "/inviteCode/getInviteInfo",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}


/**
 * 生成邀请码
 * 要打开的小程序版本。正式版为 "release"，体验版为 "trial"，开发版为 "develop"。默认是正式版。
 * @param {*} data
 * @returns
 */
export async function addInviteCodeApi(data) {
	return instance.request({
		url: "/inviteCode/addInviteCode",
		method: "post",
		custom: {
			auth: true,
		},
		data: {
			...data,
			codeStatus: 'release'
		},
	});
}


/**
 * 查询邀请码
 * @param {*} data
 * @returns
 */
export async function getInviteCodeListApi(data) {
	return instance.request({
		url: "/inviteCode/getInviteCodeList",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 删除邀请码
 * @param {*} data
 * @returns
 */
export async function delInviteCodeApi(data) {
	return instance.request({
		url: "/inviteCode/delInviteCode",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 查询我的家族
 * @param {*} data
 * @returns
 */
export async function getUserFamilyApi(data) {
	return instance.request({
		url: "/userAccount/getUserFamily",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 查询我的收益记录
 * @param {*} data
 * @returns
 */
export async function getIncomeRecordListApi(data) {
	return instance.request({
		url: "/incomeRecord/getIncomeRecordList",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 提现信息查询
 * @param {*} data
 * @returns
 */
export async function getMentionRecordInfoApi(data) {
	return instance.request({
		url: "/mentionRecord/getMentionRecordInfo",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 提现
 * @param {*} data
 * @returns
 */
export async function addMentionApi(data) {
	return instance.request({
		url: "/mentionRecord/addMention",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 提现记录
 * @param {*} data
 * @returns
 */
export async function getMentionRecordListApi(data) {
	return instance.request({
		url: "/mentionRecord/getMentionRecordList",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}

/**
 * 获取邀请详情
 * @param {*} data
 * @returns
 */
export async function getInviteCodeInfoApi(data) {
	return instance.request({
		url: "/inviteCode/getInviteCodeInfo",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}


/**
 * 修改用户信息
 * @param {*} data
 * @returns
 */
export async function updUserInfoApi(data) {
	return instance.request({
		url: "/userAccount/updUserInfo",
		method: "post",
		custom: {
			auth: true,
		},
		data,
	});
}



